﻿using System.Collections.Generic;
using System.Linq;
using W.Models.DataAccess;

namespace W.Component
{
    public class CaracteristicasComponent : ComponentBase<Caracteristicas>
    {
        public List<Caracteristicas> Get()
        {
            return this.Model.Caracteristicas.ToList();
        }

        public List<Caracteristicas> Find(int IdAula)
        {
            return this.Get().FindAll(t => t.Aulas.id == IdAula);
        }

        public override void Create(Caracteristicas Entity)
        {
            Entity.TiposCaracteristicas = this.Get<TiposCaracteristicas>(Entity.TiposCaracteristicas.id);
            Entity.Aulas = (Aulas)this.Get<Recursos>(Entity.Aulas.id);

            base.Create(Entity);
        }
    }
}
